package com.zhang.controller;

import com.zhang.domain.User;
import com.zhang.query.UserQuery;
import com.zhang.service.IUserService;
import com.zhang.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author zh
 * @create 2022-03-02 17:25
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Resource
    private IUserService service;

    @PostMapping("code")
    private AjaxResult getCode(@RequestBody Map<String,String> phone){
         return service.getCode(phone.get("phone"));
    }
    @PostMapping("register")
    private AjaxResult register(@RequestBody UserQuery query){
        return service.regist(query);
    }
    @PostMapping("emailcode")
    private AjaxResult getemailCode(@RequestBody Map<String,String> email){
        return service.getemailCode(email.get("email"));
    }
    @PostMapping("emailregister")
    private AjaxResult emailregister(@RequestBody UserQuery query){
        return service.emailregist(query);
    }



}
